package cn.edu.nju.oraldefense.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import cn.edu.nju.oraldefense.dao.ObserverDao;
import cn.edu.nju.oraldefense.model.Observer;
import cn.edu.nju.oraldefense.service.ObserverService;
@Component("observerService")
public class ObserverServiceImpl implements ObserverService{
	private ObserverDao observerDao;

	public ObserverDao getObserverDao() {
		return observerDao;
	}
	@Resource
	public void setObserverDao(ObserverDao observerDao) {
		this.observerDao = observerDao;
	}
	
	public Observer getByUsername(String username) {
		List list = observerDao.findByUsername(username);
		Observer observer = null;
		if (list.size() > 0) {
			observer = (Observer) list.get(0);
		}
		return observer;
	}
}
